package com.wxy.jk.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wxy.jk.common.enchance.MpLambdaQueryWrapper;
import com.wxy.jk.mapper.SysRoleResourceMapper;
import com.wxy.jk.pojo.po.SysRoleResource;
import com.wxy.jk.service.SysRoleResourceService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Service
@Transactional
public class SysRoleResourceServiceImpl extends ServiceImpl<SysRoleResourceMapper, SysRoleResource> implements SysRoleResourceService {

    @Override
    public boolean removeByRoleId(Short roleId) {
        MpLambdaQueryWrapper<SysRoleResource> wrapper = new MpLambdaQueryWrapper<>();
        if(roleId == null || roleId < 0){
            wrapper.eq(SysRoleResource::getRoleId, roleId);
        }

        return baseMapper.delete(wrapper) > 0;
    }
}
